<div class="jumbotron">

    <table  class="table table-bordered table-hover">
        <tr >
            <th colspan="6" >
            <span style="font-size: 24px;"><{$title}></span>(共 <span style="color:red;"><{$messages|count}></span> 条)
            <a style="margin-left: 20px;" href="/sendMessage.html" class="btn btn-warning btn-xs " role="button" >发件箱</a>
            <a tyle="color:red;" href="myMessages.html" class="btn btn-info btn-xs" role="button" >收件箱</a>

            </th>
        </tr>
        <tr>
            <th>编号</th>
            <th>内容</th>
            <th>状态</th>
            <th>发送时间</th>
            <th>回复</th>
            <th>删除</th>
        </tr>
            <volist name="messages" id="vo">
                    <tr class="message-id-<{$vo.message_id}> unread info">
                        <td class="mail-ontact">
                            <{$key+1}>
                        </td>
                        <td class="mail-ontact">
                            <a href="#" data-toggle="tooltip" data-placement="right" title="点击查看详细内容"><{$vo.message}></a>
                        </td>
                        <td class="">
                            <if condition='$vo.status eq 1'>
                                <span class="label label-danger">未读</span>
                            <elseif condition="$vo.status eq 2" />
                                <span class="label label-success">已读</span>
                            <else/>
                                <span class="label label-success">已回复</span>
                            </if>
                        </td>
                        <td class="">
                            <i class="glyphicon glyphicon-time"></i>
                            <{$vo.send_time|date="Y年m月d日 H:i",###}>
                        </td>
                        <if condition="$action eq 'sendMessage'">
                        <td>
                            <a data-toggle="tooltip" data-placement="right" title="发新消息" href="/newMessage.html>"><i class="glyphicon glyphicon-envelope"></i></a>
                        </td>
                        <else />
                        <td>
                            <a data-toggle="tooltip" data-placement="right" title="回复" href="/newMessage.html?message_id=<{$vo.message_id}>"><i class="glyphicon glyphicon-edit"></i></a>
                        </td>
                        </if>
                        <td class=" mail-date">
                            <a data-toggle="tooltip" data-placement="left" title="删除" href="javascript:delMess('<{$vo.message_id}>')"><i class="glyphicon glyphicon-trash"></i></a>
                        </td>
                    </tr>
            </volist>

    </table>

</div>
<script>
function delMess(message_id=0){
    if(message_id > 0){
        $.ajax({
         type: "POST",
         url: "<{:U('Member/delMessage')}>",
         data: "message_id="+message_id,
         success: function(msg){
            if(msg == 'success'){
                $('.message-id-'+message_id).remove();
                swal("删除成功","","success");
            }else{
              swal({
                   title:"网络不稳定，失败了！",
                   text:"",
                   type:"error"
               });
            }
         }
      });
    }
}
</script>